{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Data Processing with DataFrame \n",
        "\n",
        "[DataFrames](https://docs.microsoft.com/dotnet/api/microsoft.data.analysis.dataframe?view=ml-dotnet-preview) are an easy way to explore and manipulate data. We can load, convert, and combine data.  \n",
        "\n",
        "Let's take a look at the following examples of hockey data. We have information on US and European players, plus a list of player salaries. Let's combine all of this into a single dataset for predicting salaries. Let's normalize the data of US and European players, combine them into one source, and then union with player salaries.  "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Load packages\n",
        "\n",
        "Get data frame api, visualization and formatting."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "// using nightly-build\n",
        "#i \"nuget:https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json\"\n",
        "#r \"nuget: Microsoft.Data.Analysis, 0.20.0-preview.22356.1\"\n",
        "#r \"nuget: Microsoft.ML, 2.0.0-preview.22356.1\""
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<div><div><strong>Restore sources</strong><ul><li><span>https://pkgs.dev.azure.com/dnceng/public/_packaging/MachineLearning/nuget/v3/index.json</span></li></ul></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Microsoft.Data.Analysis, 0.20.0-preview.22356.1</span></li><li><span>Microsoft.ML, 2.0.0-preview.22356.1</span></li></ul></div></div>"
          },
          "execution_count": 1,
          "metadata": {}
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/markdown": "Loading extensions from `Microsoft.Data.Analysis.Interactive.dll`"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Inspect data\n",
        "\n",
        "Let's get started loading our data on the players from the US into a DataFrame."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "#### Download or Locate Data\n",
        "The following code tries to locate the data file in a few known locations or it will download it from the known GitHub location."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "using System;\n",
        "using System.IO;\n",
        "using System.Net;\n",
        "\n",
        "string EnsureDataSetDownloaded(string fileName)\n",
        "{\n",
        "\n",
        "\t// This is the path if the repo has been checked out.\n",
        "\tvar filePath = Path.Combine(Directory.GetCurrentDirectory(),\"data\", fileName);\n",
        "\n",
        "\tif (!File.Exists(filePath))\n",
        "\t{\n",
        "\t\t// This is the path if the file has already been downloaded.\n",
        "\t\tfilePath = Path.Combine(Directory.GetCurrentDirectory(), fileName);\n",
        "\t}\n",
        "\n",
        "\tif (!File.Exists(filePath))\n",
        "\t{\n",
        "\t\tusing (var client = new WebClient())\n",
        "\t\t{\n",
        "\t\t\tclient.DownloadFile($\"https://raw.githubusercontent.com/dotnet/csharp-notebooks/main/machine-learning/data/{fileName}\", filePath);\n",
        "\t\t}\n",
        "\t\tConsole.WriteLine($\"Downloaded {fileName}  to : {filePath}\");\n",
        "\t}\n",
        "\telse\n",
        "\t{\n",
        "\t\tConsole.WriteLine($\"{fileName} found here: {filePath}\");\n",
        "\t}\n",
        "\n",
        "\treturn filePath;\n",
        "}"
      ],
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "using System.Linq;\n",
        "using Microsoft.Data.Analysis;\n",
        "\n",
        "var usaDataPath = EnsureDataSetDownloaded(\"usa_hockey.csv\"); \n",
        "var usaDf = DataFrame.LoadCsv(usaDataPath);"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": "usa_hockey.csv found here: C:\\dev\\csharp-notebooks\\machine-learning\\data\\usa_hockey.csv\r\n"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "DataFrames store data as a collection of columns. This makes it easy to interact with the data. To get a preview of the columns, we'll run `Info()`.\n",
        "\n",
        "Here we have a information about the players, where they were born, their height and weight, etc. We also have statistics on their play, like the number of goals/assists, points scored, and games played. \n",
        "\n",
        "We can already see that some fields have fewer values than other. Draft year is only available for 7 out of 10 players. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "usaDf.Info()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949516539988\"><thead><tr><th><i>index</i></th><th>Info</th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>DataType</td><td>System.String</td><td>System.String</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>Length (excluding null values)</td><td>10</td><td>10</td><td>10</td><td>10</td><td>7</td><td>7</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Take a look at the actual data. Everything looks pretty normal, but there are some null values. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "usaDf"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949517032420\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>88-16-04</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">218</div></td><td><div class=\"dni-plaintext\">2006</div></td><td><div class=\"dni-plaintext\">7</div></td><td>R</td><td>Okposo</td><td>Kyle</td><td>RW</td><td>BUF</td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">26</div></td><td><div class=\"dni-plaintext\">45</div></td><td><div class=\"dni-plaintext\">24</div></td><td><div class=\"dni-plaintext\">1443</div></td><td><div class=\"dni-plaintext\">73983</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>90-08-10</td><td>USA</td><td><div class=\"dni-plaintext\">76</div></td><td><div class=\"dni-plaintext\">210</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">114</div></td><td>L</td><td>Helgeson</td><td>Seth</td><td>D</td><td>N.J</td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">177</div></td><td><div class=\"dni-plaintext\">7273</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>96-26-11</td><td>USA</td><td><div class=\"dni-plaintext\">77</div></td><td><div class=\"dni-plaintext\">203</div></td><td><div class=\"dni-plaintext\">2015</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Carlo</td><td>Brandon</td><td>D</td><td>BOS</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">2080</div></td><td><div class=\"dni-plaintext\">102414</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>90-16-11</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">219</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Schaller</td><td>Tim</td><td>C</td><td>BOS</td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">1035</div></td><td><div class=\"dni-plaintext\">43436</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>92-20-03</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">215</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Faulk</td><td>Justin</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">32</div></td><td><div class=\"dni-plaintext\">1987</div></td><td><div class=\"dni-plaintext\">104133</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>94-01-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">120</div></td><td>L</td><td>Slavin</td><td>Jaccob</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">29</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">2135</div></td><td><div class=\"dni-plaintext\">115316</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-20-06</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">128</div></td><td>R</td><td>Pateryn</td><td>Greg</td><td>D</td><td>DAL/MTL</td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">8</div></td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">720</div></td><td><div class=\"dni-plaintext\">33312</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>90-27-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">196</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">198</div></td><td>R</td><td>Dowd</td><td>Nic</td><td>C</td><td>L.A</td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">25</div></td><td><div class=\"dni-plaintext\">1230</div></td><td><div class=\"dni-plaintext\">52314</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>90-16-07</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Lashoff</td><td>Brian</td><td>D</td><td>DET</td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">3754</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>86-09-08</td><td>USA</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">197</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>R</td><td>Cannone</td><td>Patrick</td><td>C</td><td>MIN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">35</div></td><td><div class=\"dni-plaintext\">1419</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Europe data\n",
        "\n",
        "We also have data for some European players. Let's preview the data and see how it's different. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "var europeDataPath = EnsureDataSetDownloaded(\"europe_hockey.csv\"); \n",
        "var europeDf = DataFrame.LoadCsv(europeDataPath);\n",
        "europeDf.Info()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949517540518\"><thead><tr><th><i>index</i></th><th>Info</th><th>Birthday</th><th>Nat</th><th>Height_cm</th><th>Weight_kg</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>DataType</td><td>System.String</td><td>System.String</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.String</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td><td>System.Single</td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>Length (excluding null values)</td><td>10</td><td>10</td><td>10</td><td>10</td><td>8</td><td>8</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td><td>10</td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "The values look very similar to the US players. One difference is height is in centimeters and weight is in kilograms. Some of the values in this file are missing too. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "europeDf"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949517773562\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height_cm</th><th>Weight_kg</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>90-11-21</td><td>SWE</td><td><div class=\"dni-plaintext\">180</div></td><td><div class=\"dni-plaintext\">84</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">53</div></td><td>L</td><td>Rodin</td><td>Anton</td><td>RW</td><td>VAN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">40</div></td><td><div class=\"dni-plaintext\">1604</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>86-04-28</td><td>CZE</td><td><div class=\"dni-plaintext\">188</div></td><td><div class=\"dni-plaintext\">107</div></td><td><div class=\"dni-plaintext\">2004</div></td><td><div class=\"dni-plaintext\">180</div></td><td>R</td><td>Polak</td><td>Roman</td><td>D</td><td>TOR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">1817</div></td><td><div class=\"dni-plaintext\">80643</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>90-11-29</td><td>CZE</td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">100</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>R</td><td>Sustr</td><td>Andrej</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">80</div></td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">43</div></td><td><div class=\"dni-plaintext\">1813</div></td><td><div class=\"dni-plaintext\">84427</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>96-05-25</td><td>CZE</td><td><div class=\"dni-plaintext\">183</div></td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>Pastrnak</td><td>David</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>94/03/23</td><td>SWE</td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">95</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">81</div></td><td>R</td><td>Sundqvist</td><td>Oskar</td><td>C</td><td>PIT</td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">2</div></td><td><div class=\"dni-plaintext\">138</div></td><td><div class=\"dni-plaintext\">5504</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>90-06-05</td><td>CZE</td><td><div class=\"dni-plaintext\">183</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">66</div></td><td>R</td><td>Gudas</td><td>Radko</td><td>D</td><td>PHI</td><td><div class=\"dni-plaintext\">67</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">1739</div></td><td><div class=\"dni-plaintext\">77555</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-06-01</td><td>CHE</td><td><div class=\"dni-plaintext\">185</div></td><td><div class=\"dni-plaintext\">91</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">38</div></td><td>L</td><td>Josi</td><td>Roman</td><td>D</td><td>NSH</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">49</div></td><td><div class=\"dni-plaintext\">18</div></td><td><div class=\"dni-plaintext\">2076</div></td><td><div class=\"dni-plaintext\">108323</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>86-08-01</td><td>SWE</td><td><div class=\"dni-plaintext\">180</div></td><td><div class=\"dni-plaintext\">86</div></td><td><div class=\"dni-plaintext\">2005</div></td><td><div class=\"dni-plaintext\">216</div></td><td>R</td><td>Stralman</td><td>Anton</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">1963</div></td><td><div class=\"dni-plaintext\">100304</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>92-11-12</td><td>SWE</td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">98</div></td><td><div class=\"dni-plaintext\">2011</div></td><td><div class=\"dni-plaintext\">4</div></td><td>R</td><td>Larsson</td><td>Adam</td><td>D</td><td>EDM</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">55</div></td><td><div class=\"dni-plaintext\">2055</div></td><td><div class=\"dni-plaintext\">95509</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>89-11-21</td><td>FRA</td><td><div class=\"dni-plaintext\">183</div></td><td><div class=\"dni-plaintext\">91</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Roussel</td><td>Antoine</td><td>LW</td><td>DAL</td><td><div class=\"dni-plaintext\">60</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">27</div></td><td><div class=\"dni-plaintext\">115</div></td><td><div class=\"dni-plaintext\">1427</div></td><td><div class=\"dni-plaintext\">55866</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Looking at the acutal data we can see that birthday is in a different format YY-MM-DD format. \n",
        "\n",
        "Let's dive in a little further and see which countries are represented here. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "europeDf[\"Nat\"].ValueCounts()"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949518339650\"><thead><tr><th><i>index</i></th><th>Values</th><th>Counts</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>SWE</td><td><div class=\"dni-plaintext\">4</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>CZE</td><td><div class=\"dni-plaintext\">4</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>CHE</td><td><div class=\"dni-plaintext\">1</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>FRA</td><td><div class=\"dni-plaintext\">1</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Convert data\n",
        "\n",
        "Now that we know something about the data let's normalize and combine these data sources into one. "
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Europe players have height and weight in kilograms and centimeters. Since these are players are in the NHL, let's convert these values into pounds and inches to match the American players."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "europeDf[\"Weight_kg\"] = europeDf[\"Weight_kg\"].Multiply(2.20462262).Round(); \n",
        "europeDf[\"Height_cm\"] = europeDf[\"Height_cm\"].Divide(2.54).Round();\n",
        "\n",
        "europeDf[\"Weight_kg\"].SetName(\"Weight\"); \n",
        "europeDf[\"Height_cm\"].SetName(\"Height\");"
      ],
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Let's also convert the European birthday to the American format for consistency. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "// There are birthdays in the format \"1999/1/1\" and \"1999-1-1\". Include both splitter characters. \n",
        "char[] delimiterChars = { '-', '/'};\n",
        "\n",
        "var birthday = \n",
        "    ((IEnumerable<string>)europeDf[\"Birthday\"])\n",
        "        .Select(x => x.Split(delimiterChars));\n",
        "\n",
        "europeDf[\"Birthday\"] = new StringDataFrameColumn(\"Birthday\", birthday.Select(x => x[0] + \"-\" + x[2] + \"-\" + x[1]));"
      ],
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "To combine the DataFrames they need to look identical. Let's sample some data and confirm the shape is the same. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "europeDf.Sample(1)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949534939858\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>96-25-05</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">181</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>Pastrnak</td><td>David</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "usaDf.Sample(1)"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949535198884\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>90-27-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">196</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">198</div></td><td>R</td><td>Dowd</td><td>Nic</td><td>C</td><td>L.A</td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">25</div></td><td><div class=\"dni-plaintext\">1230</div></td><td><div class=\"dni-plaintext\">52314</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Combine data sources"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "var allPlayersDf = usaDf.Clone();\n",
        "europeDf.Rows.ToList<DataFrameRow>().ForEach(row => {allPlayersDf.Append(row, /*append in place*/ true);})"
      ],
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "We now have one DataFrame with all the player information. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "allPlayersDf"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949540376912\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>88-16-04</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">218</div></td><td><div class=\"dni-plaintext\">2006</div></td><td><div class=\"dni-plaintext\">7</div></td><td>R</td><td>Okposo</td><td>Kyle</td><td>RW</td><td>BUF</td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">26</div></td><td><div class=\"dni-plaintext\">45</div></td><td><div class=\"dni-plaintext\">24</div></td><td><div class=\"dni-plaintext\">1443</div></td><td><div class=\"dni-plaintext\">73983</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>90-08-10</td><td>USA</td><td><div class=\"dni-plaintext\">76</div></td><td><div class=\"dni-plaintext\">210</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">114</div></td><td>L</td><td>Helgeson</td><td>Seth</td><td>D</td><td>N.J</td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">177</div></td><td><div class=\"dni-plaintext\">7273</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>96-26-11</td><td>USA</td><td><div class=\"dni-plaintext\">77</div></td><td><div class=\"dni-plaintext\">203</div></td><td><div class=\"dni-plaintext\">2015</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Carlo</td><td>Brandon</td><td>D</td><td>BOS</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">2080</div></td><td><div class=\"dni-plaintext\">102414</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>90-16-11</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">219</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Schaller</td><td>Tim</td><td>C</td><td>BOS</td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">1035</div></td><td><div class=\"dni-plaintext\">43436</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>92-20-03</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">215</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Faulk</td><td>Justin</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">32</div></td><td><div class=\"dni-plaintext\">1987</div></td><td><div class=\"dni-plaintext\">104133</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>94-01-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">120</div></td><td>L</td><td>Slavin</td><td>Jaccob</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">29</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">2135</div></td><td><div class=\"dni-plaintext\">115316</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-20-06</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">128</div></td><td>R</td><td>Pateryn</td><td>Greg</td><td>D</td><td>DAL/MTL</td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">8</div></td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">720</div></td><td><div class=\"dni-plaintext\">33312</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>90-27-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">196</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">198</div></td><td>R</td><td>Dowd</td><td>Nic</td><td>C</td><td>L.A</td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">25</div></td><td><div class=\"dni-plaintext\">1230</div></td><td><div class=\"dni-plaintext\">52314</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>90-16-07</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Lashoff</td><td>Brian</td><td>D</td><td>DET</td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">3754</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>86-09-08</td><td>USA</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">197</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>R</td><td>Cannone</td><td>Patrick</td><td>C</td><td>MIN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">35</div></td><td><div class=\"dni-plaintext\">1419</div></td></tr><tr><td><i><div class=\"dni-plaintext\">10</div></i></td><td>90-21-11</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">185</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">53</div></td><td>L</td><td>Rodin</td><td>Anton</td><td>RW</td><td>VAN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">40</div></td><td><div class=\"dni-plaintext\">1604</div></td></tr><tr><td><i><div class=\"dni-plaintext\">11</div></i></td><td>86-28-04</td><td>CZE</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">236</div></td><td><div class=\"dni-plaintext\">2004</div></td><td><div class=\"dni-plaintext\">180</div></td><td>R</td><td>Polak</td><td>Roman</td><td>D</td><td>TOR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">1817</div></td><td><div class=\"dni-plaintext\">80643</div></td></tr><tr><td><i><div class=\"dni-plaintext\">12</div></i></td><td>90-29-11</td><td>CZE</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">220</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>R</td><td>Sustr</td><td>Andrej</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">80</div></td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">43</div></td><td><div class=\"dni-plaintext\">1813</div></td><td><div class=\"dni-plaintext\">84427</div></td></tr><tr><td><i><div class=\"dni-plaintext\">13</div></i></td><td>96-25-05</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">181</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>Pastrnak</td><td>David</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td></tr><tr><td><i><div class=\"dni-plaintext\">14</div></i></td><td>94-23-03</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">209</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">81</div></td><td>R</td><td>Sundqvist</td><td>Oskar</td><td>C</td><td>PIT</td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">2</div></td><td><div class=\"dni-plaintext\">138</div></td><td><div class=\"dni-plaintext\">5504</div></td></tr><tr><td><i><div class=\"dni-plaintext\">15</div></i></td><td>90-05-06</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">66</div></td><td>R</td><td>Gudas</td><td>Radko</td><td>D</td><td>PHI</td><td><div class=\"dni-plaintext\">67</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">1739</div></td><td><div class=\"dni-plaintext\">77555</div></td></tr><tr><td><i><div class=\"dni-plaintext\">16</div></i></td><td>90-01-06</td><td>CHE</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">38</div></td><td>L</td><td>Josi</td><td>Roman</td><td>D</td><td>NSH</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">49</div></td><td><div class=\"dni-plaintext\">18</div></td><td><div class=\"dni-plaintext\">2076</div></td><td><div class=\"dni-plaintext\">108323</div></td></tr><tr><td><i><div class=\"dni-plaintext\">17</div></i></td><td>86-01-08</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">2005</div></td><td><div class=\"dni-plaintext\">216</div></td><td>R</td><td>Stralman</td><td>Anton</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">1963</div></td><td><div class=\"dni-plaintext\">100304</div></td></tr><tr><td><i><div class=\"dni-plaintext\">18</div></i></td><td>92-12-11</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">216</div></td><td><div class=\"dni-plaintext\">2011</div></td><td><div class=\"dni-plaintext\">4</div></td><td>R</td><td>Larsson</td><td>Adam</td><td>D</td><td>EDM</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">55</div></td><td><div class=\"dni-plaintext\">2055</div></td><td><div class=\"dni-plaintext\">95509</div></td></tr><tr><td><i><div class=\"dni-plaintext\">19</div></i></td><td>89-21-11</td><td>FRA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td><td>L</td><td>Roussel</td><td>Antoine</td><td>LW</td><td>DAL</td><td><div class=\"dni-plaintext\">60</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">27</div></td><td><div class=\"dni-plaintext\">115</div></td><td><div class=\"dni-plaintext\">1427</div></td><td><div class=\"dni-plaintext\">55866</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "The lists are combined together, but we have some missing data for Draft Year and Overall Draft position. Let's replace those nulls so they don't mess up our training. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "// We're missing information in DraftYear and OverallDraft\n",
        "allPlayersDf[\"DraftYear\"] = allPlayersDf[\"DraftYear\"].FillNulls(2000); \n",
        "\n",
        "var medianDraft = allPlayersDf[\"OverallDraft\"].Median();\n",
        "allPlayersDf[\"OverallDraft\"] = allPlayersDf[\"OverallDraft\"].FillNulls(medianDraft); \n",
        "\n",
        "allPlayersDf"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949540783969\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Last Name</th><th>First Name</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>88-16-04</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">218</div></td><td><div class=\"dni-plaintext\">2006</div></td><td><div class=\"dni-plaintext\">7</div></td><td>R</td><td>Okposo</td><td>Kyle</td><td>RW</td><td>BUF</td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">26</div></td><td><div class=\"dni-plaintext\">45</div></td><td><div class=\"dni-plaintext\">24</div></td><td><div class=\"dni-plaintext\">1443</div></td><td><div class=\"dni-plaintext\">73983</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>90-08-10</td><td>USA</td><td><div class=\"dni-plaintext\">76</div></td><td><div class=\"dni-plaintext\">210</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">114</div></td><td>L</td><td>Helgeson</td><td>Seth</td><td>D</td><td>N.J</td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">177</div></td><td><div class=\"dni-plaintext\">7273</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>96-26-11</td><td>USA</td><td><div class=\"dni-plaintext\">77</div></td><td><div class=\"dni-plaintext\">203</div></td><td><div class=\"dni-plaintext\">2015</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Carlo</td><td>Brandon</td><td>D</td><td>BOS</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">2080</div></td><td><div class=\"dni-plaintext\">102414</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>90-16-11</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">219</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>Schaller</td><td>Tim</td><td>C</td><td>BOS</td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">1035</div></td><td><div class=\"dni-plaintext\">43436</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>92-20-03</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">215</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>Faulk</td><td>Justin</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">32</div></td><td><div class=\"dni-plaintext\">1987</div></td><td><div class=\"dni-plaintext\">104133</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>94-01-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">120</div></td><td>L</td><td>Slavin</td><td>Jaccob</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">29</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">2135</div></td><td><div class=\"dni-plaintext\">115316</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-20-06</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">128</div></td><td>R</td><td>Pateryn</td><td>Greg</td><td>D</td><td>DAL/MTL</td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">8</div></td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">720</div></td><td><div class=\"dni-plaintext\">33312</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>90-27-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">196</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">198</div></td><td>R</td><td>Dowd</td><td>Nic</td><td>C</td><td>L.A</td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">25</div></td><td><div class=\"dni-plaintext\">1230</div></td><td><div class=\"dni-plaintext\">52314</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>90-16-07</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>Lashoff</td><td>Brian</td><td>D</td><td>DET</td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">3754</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>86-09-08</td><td>USA</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">197</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>Cannone</td><td>Patrick</td><td>C</td><td>MIN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">35</div></td><td><div class=\"dni-plaintext\">1419</div></td></tr><tr><td><i><div class=\"dni-plaintext\">10</div></i></td><td>90-21-11</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">185</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">53</div></td><td>L</td><td>Rodin</td><td>Anton</td><td>RW</td><td>VAN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">40</div></td><td><div class=\"dni-plaintext\">1604</div></td></tr><tr><td><i><div class=\"dni-plaintext\">11</div></i></td><td>86-28-04</td><td>CZE</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">236</div></td><td><div class=\"dni-plaintext\">2004</div></td><td><div class=\"dni-plaintext\">180</div></td><td>R</td><td>Polak</td><td>Roman</td><td>D</td><td>TOR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">1817</div></td><td><div class=\"dni-plaintext\">80643</div></td></tr><tr><td><i><div class=\"dni-plaintext\">12</div></i></td><td>90-29-11</td><td>CZE</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">220</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>Sustr</td><td>Andrej</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">80</div></td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">43</div></td><td><div class=\"dni-plaintext\">1813</div></td><td><div class=\"dni-plaintext\">84427</div></td></tr><tr><td><i><div class=\"dni-plaintext\">13</div></i></td><td>96-25-05</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">181</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>Pastrnak</td><td>David</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td></tr><tr><td><i><div class=\"dni-plaintext\">14</div></i></td><td>94-23-03</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">209</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">81</div></td><td>R</td><td>Sundqvist</td><td>Oskar</td><td>C</td><td>PIT</td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">2</div></td><td><div class=\"dni-plaintext\">138</div></td><td><div class=\"dni-plaintext\">5504</div></td></tr><tr><td><i><div class=\"dni-plaintext\">15</div></i></td><td>90-05-06</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">66</div></td><td>R</td><td>Gudas</td><td>Radko</td><td>D</td><td>PHI</td><td><div class=\"dni-plaintext\">67</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">1739</div></td><td><div class=\"dni-plaintext\">77555</div></td></tr><tr><td><i><div class=\"dni-plaintext\">16</div></i></td><td>90-01-06</td><td>CHE</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">38</div></td><td>L</td><td>Josi</td><td>Roman</td><td>D</td><td>NSH</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">49</div></td><td><div class=\"dni-plaintext\">18</div></td><td><div class=\"dni-plaintext\">2076</div></td><td><div class=\"dni-plaintext\">108323</div></td></tr><tr><td><i><div class=\"dni-plaintext\">17</div></i></td><td>86-01-08</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">2005</div></td><td><div class=\"dni-plaintext\">216</div></td><td>R</td><td>Stralman</td><td>Anton</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">1963</div></td><td><div class=\"dni-plaintext\">100304</div></td></tr><tr><td><i><div class=\"dni-plaintext\">18</div></i></td><td>92-12-11</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">216</div></td><td><div class=\"dni-plaintext\">2011</div></td><td><div class=\"dni-plaintext\">4</div></td><td>R</td><td>Larsson</td><td>Adam</td><td>D</td><td>EDM</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">55</div></td><td><div class=\"dni-plaintext\">2055</div></td><td><div class=\"dni-plaintext\">95509</div></td></tr><tr><td><i><div class=\"dni-plaintext\">19</div></i></td><td>89-21-11</td><td>FRA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>Roussel</td><td>Antoine</td><td>LW</td><td>DAL</td><td><div class=\"dni-plaintext\">60</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">27</div></td><td><div class=\"dni-plaintext\">115</div></td><td><div class=\"dni-plaintext\">1427</div></td><td><div class=\"dni-plaintext\">55866</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now that our player information looks good, let's take a look at the salary data we're trying to union with.\n",
        "\n",
        "This file is in JSON format. DataFrames don't support loading from JSON yet. There is a work around. It's fairly easy to convert from IDataView to DataFrame. Let's use that method to get what we need. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "public class PlayerSalary\n",
        "{\n",
        "    public string Name { get; set; }\n",
        "\n",
        "    public float Salary { get; set; }\n",
        "}"
      ],
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "using System.Text.Json;\n",
        "using System.IO; \n",
        "using Microsoft.ML; \n",
        "\n",
        "// Read in JSON file\n",
        "string jsonString = File.ReadAllText(@\"data/playerSalary.json\");\n",
        "var players = JsonSerializer.Deserialize<List<PlayerSalary>>(jsonString);\n",
        "\n",
        "// Load it into an IDataView\n",
        "MLContext mlContext = new MLContext();\n",
        "IDataView data = mlContext.Data.LoadFromEnumerable<PlayerSalary>(players);\n",
        "\n",
        "// Convert to a DataFrame\n",
        "var playerSalaryDf = data.ToDataFrame();\n",
        "\n",
        "playerSalaryDf"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949564105780\"><thead><tr><th><i>index</i></th><th>Name</th><th>Salary</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>Adam Larsson</td><td><div class=\"dni-plaintext\">3000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>Andrej Sustr</td><td><div class=\"dni-plaintext\">1600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>Antoine Roussel</td><td><div class=\"dni-plaintext\">2200000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>Anton Rodin</td><td><div class=\"dni-plaintext\">950000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>Anton Stralman</td><td><div class=\"dni-plaintext\">4500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>Brandon Carlo</td><td><div class=\"dni-plaintext\">717500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>Brian Lashoff</td><td><div class=\"dni-plaintext\">650000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>David Pastrnak</td><td><div class=\"dni-plaintext\">925000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>Greg Pateryn</td><td><div class=\"dni-plaintext\">750000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>Jaccob Slavin</td><td><div class=\"dni-plaintext\">742500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">10</div></i></td><td>Justin Faulk</td><td><div class=\"dni-plaintext\">5500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">11</div></i></td><td>Kyle Okposo</td><td><div class=\"dni-plaintext\">8000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">12</div></i></td><td>Oskar Sundqvist</td><td><div class=\"dni-plaintext\">792500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">13</div></i></td><td>Patrick Cannone</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">14</div></i></td><td>Radko Gudas</td><td><div class=\"dni-plaintext\">4000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">15</div></i></td><td>Roman Josi</td><td><div class=\"dni-plaintext\">4250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">16</div></i></td><td>Roman Polak</td><td><div class=\"dni-plaintext\">2250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">17</div></i></td><td>Seth Helgeson</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">18</div></i></td><td>Tim Schaller</td><td><div class=\"dni-plaintext\">600000</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Convert two columns into one\n",
        "\n",
        "Our player salary information has the name format \"First Last\". The player details has two separate columns for first and last name. Let's fix this. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "// Grab first and last name. Zip them together into one list. \n",
        "var firstNames = (IEnumerable<string>)allPlayersDf[\"First Name\"]; \n",
        "var lastNames = (IEnumerable<string>)allPlayersDf[\"Last Name\"];\n",
        "var fullNames = firstNames.Zip(lastNames, (first, last) => first + \" \" + last); \n",
        "\n",
        "// Create the new column from the combined names\n",
        "allPlayersDf[\"FullName\"] = new StringDataFrameColumn(\"FullName\", fullNames); \n",
        "\n",
        "// Cleanup the unneeded first and last name columns \n",
        "allPlayersDf.Columns.Remove(\"First Name\"); \n",
        "allPlayersDf.Columns.Remove(\"Last Name\"); "
      ],
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "### Merge two DataFrames together\n",
        " \n",
        "Join the player salaries with player information. We will join on the Name information. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "// Merge the player salary information with the player details. \n",
        "var allPlayersWithSalaries = allPlayersDf.Merge(playerSalaryDf, new string[] {\"FullName\"}, new string[] {\"Name\"});\n",
        "\n",
        "// We now have two columns with names. Remove one. \n",
        "allPlayersWithSalaries.Columns.Remove(\"Name\");\n",
        "\n",
        "// Just for fun, let's put them in alphabetical order \n",
        "allPlayersWithSalaries = allPlayersWithSalaries.OrderBy(\"FullName\"); "
      ],
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "allPlayersWithSalaries"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949578968612\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th><th>FullName</th><th>Salary</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>92-12-11</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">216</div></td><td><div class=\"dni-plaintext\">2011</div></td><td><div class=\"dni-plaintext\">4</div></td><td>R</td><td>D</td><td>EDM</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">55</div></td><td><div class=\"dni-plaintext\">2055</div></td><td><div class=\"dni-plaintext\">95509</div></td><td>Adam Larsson</td><td><div class=\"dni-plaintext\">3000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>90-29-11</td><td>CZE</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">220</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">80</div></td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">43</div></td><td><div class=\"dni-plaintext\">1813</div></td><td><div class=\"dni-plaintext\">84427</div></td><td>Andrej Sustr</td><td><div class=\"dni-plaintext\">1600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>89-21-11</td><td>FRA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>LW</td><td>DAL</td><td><div class=\"dni-plaintext\">60</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">27</div></td><td><div class=\"dni-plaintext\">115</div></td><td><div class=\"dni-plaintext\">1427</div></td><td><div class=\"dni-plaintext\">55866</div></td><td>Antoine Roussel</td><td><div class=\"dni-plaintext\">2200000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>90-21-11</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">185</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">53</div></td><td>L</td><td>RW</td><td>VAN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">40</div></td><td><div class=\"dni-plaintext\">1604</div></td><td>Anton Rodin</td><td><div class=\"dni-plaintext\">950000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>86-01-08</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">2005</div></td><td><div class=\"dni-plaintext\">216</div></td><td>R</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">1963</div></td><td><div class=\"dni-plaintext\">100304</div></td><td>Anton Stralman</td><td><div class=\"dni-plaintext\">4500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>96-26-11</td><td>USA</td><td><div class=\"dni-plaintext\">77</div></td><td><div class=\"dni-plaintext\">203</div></td><td><div class=\"dni-plaintext\">2015</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>D</td><td>BOS</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">2080</div></td><td><div class=\"dni-plaintext\">102414</div></td><td>Brandon Carlo</td><td><div class=\"dni-plaintext\">717500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-16-07</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>D</td><td>DET</td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">3754</div></td><td>Brian Lashoff</td><td><div class=\"dni-plaintext\">650000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>96-25-05</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">181</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td><td>David Pastrnak</td><td><div class=\"dni-plaintext\">925000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>90-20-06</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">128</div></td><td>R</td><td>D</td><td>DAL/MTL</td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">8</div></td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">720</div></td><td><div class=\"dni-plaintext\">33312</div></td><td>Greg Pateryn</td><td><div class=\"dni-plaintext\">750000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>94-01-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">120</div></td><td>L</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">29</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">2135</div></td><td><div class=\"dni-plaintext\">115316</div></td><td>Jaccob Slavin</td><td><div class=\"dni-plaintext\">742500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">10</div></i></td><td>92-20-03</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">215</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">32</div></td><td><div class=\"dni-plaintext\">1987</div></td><td><div class=\"dni-plaintext\">104133</div></td><td>Justin Faulk</td><td><div class=\"dni-plaintext\">5500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">11</div></i></td><td>88-16-04</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">218</div></td><td><div class=\"dni-plaintext\">2006</div></td><td><div class=\"dni-plaintext\">7</div></td><td>R</td><td>RW</td><td>BUF</td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">26</div></td><td><div class=\"dni-plaintext\">45</div></td><td><div class=\"dni-plaintext\">24</div></td><td><div class=\"dni-plaintext\">1443</div></td><td><div class=\"dni-plaintext\">73983</div></td><td>Kyle Okposo</td><td><div class=\"dni-plaintext\">8000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">12</div></i></td><td>90-27-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">196</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">198</div></td><td>R</td><td>C</td><td>L.A</td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">25</div></td><td><div class=\"dni-plaintext\">1230</div></td><td><div class=\"dni-plaintext\">52314</div></td><td>Nic Dowd</td><td><div class=\"dni-plaintext\">&lt;null&gt;</div></td></tr><tr><td><i><div class=\"dni-plaintext\">13</div></i></td><td>94-23-03</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">209</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">81</div></td><td>R</td><td>C</td><td>PIT</td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">2</div></td><td><div class=\"dni-plaintext\">138</div></td><td><div class=\"dni-plaintext\">5504</div></td><td>Oskar Sundqvist</td><td><div class=\"dni-plaintext\">792500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">14</div></i></td><td>86-09-08</td><td>USA</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">197</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>C</td><td>MIN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">35</div></td><td><div class=\"dni-plaintext\">1419</div></td><td>Patrick Cannone</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">15</div></i></td><td>90-05-06</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">66</div></td><td>R</td><td>D</td><td>PHI</td><td><div class=\"dni-plaintext\">67</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">1739</div></td><td><div class=\"dni-plaintext\">77555</div></td><td>Radko Gudas</td><td><div class=\"dni-plaintext\">4000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">16</div></i></td><td>90-01-06</td><td>CHE</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">38</div></td><td>L</td><td>D</td><td>NSH</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">49</div></td><td><div class=\"dni-plaintext\">18</div></td><td><div class=\"dni-plaintext\">2076</div></td><td><div class=\"dni-plaintext\">108323</div></td><td>Roman Josi</td><td><div class=\"dni-plaintext\">4250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">17</div></i></td><td>86-28-04</td><td>CZE</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">236</div></td><td><div class=\"dni-plaintext\">2004</div></td><td><div class=\"dni-plaintext\">180</div></td><td>R</td><td>D</td><td>TOR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">1817</div></td><td><div class=\"dni-plaintext\">80643</div></td><td>Roman Polak</td><td><div class=\"dni-plaintext\">2250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">18</div></i></td><td>90-08-10</td><td>USA</td><td><div class=\"dni-plaintext\">76</div></td><td><div class=\"dni-plaintext\">210</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">114</div></td><td>L</td><td>D</td><td>N.J</td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">177</div></td><td><div class=\"dni-plaintext\">7273</div></td><td>Seth Helgeson</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">19</div></i></td><td>90-16-11</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">219</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>C</td><td>BOS</td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">1035</div></td><td><div class=\"dni-plaintext\">43436</div></td><td>Tim Schaller</td><td><div class=\"dni-plaintext\">600000</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Everything looks really good, expect we have on player without a salary. That won't be useful to us. Let's drop this null value from the table. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "allPlayersWithSalaries = allPlayersWithSalaries.DropNulls();\n",
        "allPlayersWithSalaries"
      ],
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": "<table id=\"table_637934949579237943\"><thead><tr><th><i>index</i></th><th>Birthday</th><th>Nat</th><th>Height</th><th>Weight</th><th>DraftYear</th><th>OverallDraft</th><th>Hand</th><th>Position</th><th>Team</th><th>GamesPlayed</th><th>Goals</th><th>Assists</th><th>Points</th><th>PIM</th><th>Shifts</th><th>TimeOnIce</th><th>FullName</th><th>Salary</th></tr></thead><tbody><tr><td><i><div class=\"dni-plaintext\">0</div></i></td><td>92-12-11</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">216</div></td><td><div class=\"dni-plaintext\">2011</div></td><td><div class=\"dni-plaintext\">4</div></td><td>R</td><td>D</td><td>EDM</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">55</div></td><td><div class=\"dni-plaintext\">2055</div></td><td><div class=\"dni-plaintext\">95509</div></td><td>Adam Larsson</td><td><div class=\"dni-plaintext\">3000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">1</div></i></td><td>90-29-11</td><td>CZE</td><td><div class=\"dni-plaintext\">79</div></td><td><div class=\"dni-plaintext\">220</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">80</div></td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">43</div></td><td><div class=\"dni-plaintext\">1813</div></td><td><div class=\"dni-plaintext\">84427</div></td><td>Andrej Sustr</td><td><div class=\"dni-plaintext\">1600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">2</div></i></td><td>89-21-11</td><td>FRA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>LW</td><td>DAL</td><td><div class=\"dni-plaintext\">60</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">27</div></td><td><div class=\"dni-plaintext\">115</div></td><td><div class=\"dni-plaintext\">1427</div></td><td><div class=\"dni-plaintext\">55866</div></td><td>Antoine Roussel</td><td><div class=\"dni-plaintext\">2200000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">3</div></i></td><td>90-21-11</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">185</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">53</div></td><td>L</td><td>RW</td><td>VAN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">40</div></td><td><div class=\"dni-plaintext\">1604</div></td><td>Anton Rodin</td><td><div class=\"dni-plaintext\">950000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">4</div></i></td><td>86-01-08</td><td>SWE</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">190</div></td><td><div class=\"dni-plaintext\">2005</div></td><td><div class=\"dni-plaintext\">216</div></td><td>R</td><td>D</td><td>T.B</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">22</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">1963</div></td><td><div class=\"dni-plaintext\">100304</div></td><td>Anton Stralman</td><td><div class=\"dni-plaintext\">4500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">5</div></i></td><td>96-26-11</td><td>USA</td><td><div class=\"dni-plaintext\">77</div></td><td><div class=\"dni-plaintext\">203</div></td><td><div class=\"dni-plaintext\">2015</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>D</td><td>BOS</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">16</div></td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">2080</div></td><td><div class=\"dni-plaintext\">102414</div></td><td>Brandon Carlo</td><td><div class=\"dni-plaintext\">717500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">6</div></i></td><td>90-16-07</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>D</td><td>DET</td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">3754</div></td><td>Brian Lashoff</td><td><div class=\"dni-plaintext\">650000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">7</div></i></td><td>96-25-05</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">181</div></td><td><div class=\"dni-plaintext\">2014</div></td><td><div class=\"dni-plaintext\">25</div></td><td>R</td><td>RW/LW</td><td>BOS</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">70</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">1597</div></td><td><div class=\"dni-plaintext\">80921</div></td><td>David Pastrnak</td><td><div class=\"dni-plaintext\">925000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">8</div></i></td><td>90-20-06</td><td>USA</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">221</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">128</div></td><td>R</td><td>D</td><td>DAL/MTL</td><td><div class=\"dni-plaintext\">36</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">8</div></td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">720</div></td><td><div class=\"dni-plaintext\">33312</div></td><td>Greg Pateryn</td><td><div class=\"dni-plaintext\">750000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">9</div></i></td><td>94-01-05</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">120</div></td><td>L</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">82</div></td><td><div class=\"dni-plaintext\">5</div></td><td><div class=\"dni-plaintext\">29</div></td><td><div class=\"dni-plaintext\">34</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">2135</div></td><td><div class=\"dni-plaintext\">115316</div></td><td>Jaccob Slavin</td><td><div class=\"dni-plaintext\">742500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">10</div></i></td><td>92-20-03</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">215</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">37</div></td><td>R</td><td>D</td><td>CAR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">20</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">32</div></td><td><div class=\"dni-plaintext\">1987</div></td><td><div class=\"dni-plaintext\">104133</div></td><td>Justin Faulk</td><td><div class=\"dni-plaintext\">5500000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">11</div></i></td><td>88-16-04</td><td>USA</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">218</div></td><td><div class=\"dni-plaintext\">2006</div></td><td><div class=\"dni-plaintext\">7</div></td><td>R</td><td>RW</td><td>BUF</td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">19</div></td><td><div class=\"dni-plaintext\">26</div></td><td><div class=\"dni-plaintext\">45</div></td><td><div class=\"dni-plaintext\">24</div></td><td><div class=\"dni-plaintext\">1443</div></td><td><div class=\"dni-plaintext\">73983</div></td><td>Kyle Okposo</td><td><div class=\"dni-plaintext\">8000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">12</div></i></td><td>94-23-03</td><td>SWE</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">209</div></td><td><div class=\"dni-plaintext\">2012</div></td><td><div class=\"dni-plaintext\">81</div></td><td>R</td><td>C</td><td>PIT</td><td><div class=\"dni-plaintext\">10</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">2</div></td><td><div class=\"dni-plaintext\">138</div></td><td><div class=\"dni-plaintext\">5504</div></td><td>Oskar Sundqvist</td><td><div class=\"dni-plaintext\">792500</div></td></tr><tr><td><i><div class=\"dni-plaintext\">13</div></i></td><td>86-09-08</td><td>USA</td><td><div class=\"dni-plaintext\">71</div></td><td><div class=\"dni-plaintext\">197</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>R</td><td>C</td><td>MIN</td><td><div class=\"dni-plaintext\">3</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">35</div></td><td><div class=\"dni-plaintext\">1419</div></td><td>Patrick Cannone</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">14</div></i></td><td>90-05-06</td><td>CZE</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">205</div></td><td><div class=\"dni-plaintext\">2010</div></td><td><div class=\"dni-plaintext\">66</div></td><td>R</td><td>D</td><td>PHI</td><td><div class=\"dni-plaintext\">67</div></td><td><div class=\"dni-plaintext\">6</div></td><td><div class=\"dni-plaintext\">17</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">93</div></td><td><div class=\"dni-plaintext\">1739</div></td><td><div class=\"dni-plaintext\">77555</div></td><td>Radko Gudas</td><td><div class=\"dni-plaintext\">4000000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">15</div></i></td><td>90-01-06</td><td>CHE</td><td><div class=\"dni-plaintext\">73</div></td><td><div class=\"dni-plaintext\">201</div></td><td><div class=\"dni-plaintext\">2008</div></td><td><div class=\"dni-plaintext\">38</div></td><td>L</td><td>D</td><td>NSH</td><td><div class=\"dni-plaintext\">72</div></td><td><div class=\"dni-plaintext\">12</div></td><td><div class=\"dni-plaintext\">37</div></td><td><div class=\"dni-plaintext\">49</div></td><td><div class=\"dni-plaintext\">18</div></td><td><div class=\"dni-plaintext\">2076</div></td><td><div class=\"dni-plaintext\">108323</div></td><td>Roman Josi</td><td><div class=\"dni-plaintext\">4250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">16</div></i></td><td>86-28-04</td><td>CZE</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">236</div></td><td><div class=\"dni-plaintext\">2004</div></td><td><div class=\"dni-plaintext\">180</div></td><td>R</td><td>D</td><td>TOR</td><td><div class=\"dni-plaintext\">75</div></td><td><div class=\"dni-plaintext\">4</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">11</div></td><td><div class=\"dni-plaintext\">65</div></td><td><div class=\"dni-plaintext\">1817</div></td><td><div class=\"dni-plaintext\">80643</div></td><td>Roman Polak</td><td><div class=\"dni-plaintext\">2250000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">17</div></i></td><td>90-08-10</td><td>USA</td><td><div class=\"dni-plaintext\">76</div></td><td><div class=\"dni-plaintext\">210</div></td><td><div class=\"dni-plaintext\">2009</div></td><td><div class=\"dni-plaintext\">114</div></td><td>L</td><td>D</td><td>N.J</td><td><div class=\"dni-plaintext\">9</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">0</div></td><td><div class=\"dni-plaintext\">1</div></td><td><div class=\"dni-plaintext\">15</div></td><td><div class=\"dni-plaintext\">177</div></td><td><div class=\"dni-plaintext\">7273</div></td><td>Seth Helgeson</td><td><div class=\"dni-plaintext\">600000</div></td></tr><tr><td><i><div class=\"dni-plaintext\">18</div></i></td><td>90-16-11</td><td>USA</td><td><div class=\"dni-plaintext\">74</div></td><td><div class=\"dni-plaintext\">219</div></td><td><div class=\"dni-plaintext\">2000</div></td><td><div class=\"dni-plaintext\">59.5</div></td><td>L</td><td>C</td><td>BOS</td><td><div class=\"dni-plaintext\">59</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">7</div></td><td><div class=\"dni-plaintext\">14</div></td><td><div class=\"dni-plaintext\">23</div></td><td><div class=\"dni-plaintext\">1035</div></td><td><div class=\"dni-plaintext\">43436</div></td><td>Tim Schaller</td><td><div class=\"dni-plaintext\">600000</div></td></tr></tbody></table>"
          },
          "execution_count": 1,
          "metadata": {}
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Save results\n",
        "\n",
        "We succesfully combined three different sources into one. Now it's time to save our results into a .csv file that can be used for training. "
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "dotnet_interactive": {
          "language": "csharp"
        }
      },
      "source": [
        "DataFrame.WriteCsv(allPlayersWithSalaries, \"allPlayers.csv\", ',')"
      ],
      "outputs": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": ".NET (C#)",
      "language": "C#",
      "name": ".net-csharp"
    },
    "language_info": {
      "file_extension": ".cs",
      "mimetype": "text/x-csharp",
      "name": "C#",
      "pygments_lexer": "csharp",
      "version": "8.0"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}